CC=g++
CC+= -g
CFLAGS=-c -Wall -Wextra -Wunused-variable -Wunused-but-set-variable
LDFLAGS=
SOURCES=u_generator.C libAlphaN.C libSpFission.C
OBJECTS=$(SOURCES:.C=.o)
EXECUTABLE=u_generator

CFLAGS += $(shell $(ROOTSYS)/bin/root-config --cflags)
LDFLAGS += $(shell $(ROOTSYS)/bin/root-config --libs)
LDFLAGS += -Wl,-rpath,$(CURDIR) -L$(CURDIR) -lFission

CFLAGS += -I./ -I$(CLHEP)/include/ -I../include

all: $(SOURCES) $(EXECUTABLE)

depend: .depend

.depend: $(SOURCES)
	rm -f ./.depend
	$(CC) $(CFLAGS) -MM $^ >> ./.depend;

include .depend

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(OBJECTS) -o $@ $(LDFLAGS)

.C.o:
	$(CC) $(CFLAGS) $< -o $@

clean:
	rm -f *.o; rm -f */*.o; rm -f .depend; rm $(EXECUTABLE)
